/*     */ package nccloud.framework.web.ui.pattern.billcard;
/*     */ 
/*     */ import java.util.ArrayList;
/*     */ import java.util.Arrays;
/*     */ import java.util.HashMap;
/*     */ import java.util.HashSet;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ import java.util.concurrent.ExecutorService;
/*     */ import java.util.concurrent.Executors;
/*     */ import java.util.concurrent.Future;
/*     */ import nc.md.data.access.NCObject;
/*     */ import nc.md.model.IBusinessEntity;
/*     */ import nc.vo.pub.AggregatedValueObject;
/*     */ import nc.vo.pub.CircularlyAccessibleValueObject;
/*     */ import nc.vo.pub.SuperVO;
/*     */ import nccloud.framework.core.concurrent.AbstractBaseThread;
/*     */ import nccloud.framework.core.concurrent.BaseThreadParam;
/*     */ import nccloud.framework.core.env.Locator;
/*     */ import nccloud.framework.core.exception.ExceptionUtils;
/*     */ import nccloud.framework.core.json.IJson;
/*     */ import nccloud.framework.core.log.PlatformBaseLogUtils;
/*     */ import nccloud.framework.core.model.entity.IBill;
/*     */ import nccloud.framework.core.model.entity.IVO;
/*     */ import nccloud.framework.core.model.meta.IVOMeta;
/*     */ import nccloud.framework.core.util.GridCompareUtils;
/*     */ import nccloud.framework.web.container.IRequest;
/*     */ import nccloud.framework.web.convert.translate.Translator;
/*     */ import nccloud.framework.web.json.JsonFactory;
/*     */ import nccloud.framework.web.processor.template.BillCardConvertProcessor;
/*     */ import nccloud.framework.web.ui.config.Area;
/*     */ import nccloud.framework.web.ui.config.ITempletResource;
/*     */ import nccloud.framework.web.ui.config.Item;
/*     */ import nccloud.framework.web.ui.config.PageTemplet;
/*     */ import nccloud.framework.web.ui.config.TempletQueryPara;
/*     */ import nccloud.framework.web.ui.meta.AreaRelation;
/*     */ import nccloud.framework.web.ui.model.row.Cell;
/*     */ import nccloud.framework.web.ui.model.row.Row;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class BillCardOperator
/*     */ {
/*     */   private static final String FORM = "from";
/*     */   private static final String GRID = "grid";
/*     */   private boolean excuteFormula = true;
/*     */   private BillCard billcard;
/*  72 */   private List<String> codes = new ArrayList();
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*  77 */   private List<String> noTranslatorCodes = new ArrayList();
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private BillCard originBillcard;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private String pagecode;
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private String templetid;
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private boolean transFlag = true;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCardOperator() {}
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/* 111 */   public BillCardOperator(String pagecode) { this.pagecode = pagecode; }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCardOperator(String templetid, String pagecode) {
/* 121 */     this.pagecode = pagecode;
/* 122 */     this.templetid = templetid;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCardOperator(String templetid, String pagecode, BillCard card) {
/* 133 */     this.pagecode = pagecode;
/* 134 */     this.templetid = templetid;
/* 135 */     this.billcard = card;
/* 136 */     this.originBillcard = card;
/*     */   }
/*     */ 
/*     */   
/* 140 */   public BillCard getOriginBillcard() { return this.originBillcard; }
/*     */ 
/*     */ 
/*     */   
/* 144 */   public void setExcuteFormula(boolean excuteFormula) { this.excuteFormula = excuteFormula; }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void handleCardLoadFormula() {
/* 151 */     if (this.billcard == null) {
/*     */       return;
/*     */     }
/* 154 */     BillCardFormulaHandler handler = new BillCardFormulaHandler(this.billcard);
/* 155 */     handler.handleLoadFormula();
/* 156 */     handler.handleBodyLoadFormula();
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public void handleCardValidateFormula() {
/* 163 */     if (this.billcard == null) {
/*     */       return;
/*     */     }
/* 166 */     BillCardFormulaHandler handler = new BillCardFormulaHandler(this.billcard);
/* 167 */     handler.handleValidateFormula();
/* 168 */     handler.handleBodyValidateFormula();
/*     */   }
/*     */ 
/*     */   
/* 172 */   public void setNoTranslatorCodes(List<String> noTranslatorCodes) { this.noTranslatorCodes = noTranslatorCodes; }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/* 181 */   public void setCodes(List<String> codes) { this.codes = codes; }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/* 187 */   public void setOriginBillcard(BillCard originBillcard) { this.originBillcard = originBillcard; }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/* 196 */   public void setTransFlag(boolean transFlag) { this.transFlag = transFlag; }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public <T> T toBill(IRequest request) {
/* 207 */     String str = request.read();
/* 208 */     IJson json = JsonFactory.create();
/* 209 */     BillCard card = (BillCard)json.fromJson(str, BillCard.class);
/* 210 */     this.billcard = card;
/* 211 */     this.originBillcard = card;
/* 212 */     this.pagecode = card.getPageid();
/* 213 */     this.templetid = card.getTempletid();
/*     */     
/* 215 */     BillCardConvertProcessor processor = new BillCardConvertProcessor();
/* 216 */     return (T)processor.fromBillCard(card);
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public <T> T toBill(IRequest req, List<String> areacodes) {
/* 230 */     String str = req.read();
/* 231 */     IJson json = JsonFactory.create();
/* 232 */     BillCard card = (BillCard)json.fromJson(str, BillCard.class);
/* 233 */     this.pagecode = card.getPageid();
/* 234 */     this.templetid = card.getTempletid();
/* 235 */     this.billcard = card;
/*     */     
/* 237 */     BillCardConvertProcessor processor = new BillCardConvertProcessor(areacodes);
/* 238 */     return (T)processor.fromBillCard(card);
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCard toCard(Object vo) {
/* 251 */     ITempletResource resourc = (ITempletResource)Locator.find(ITempletResource.class);
/* 252 */     TempletQueryPara para = new TempletQueryPara();
/* 253 */     para.setPagecode(this.pagecode);
/* 254 */     para.setTemplateid(this.templetid);
/* 255 */     PageTemplet ptemplet = resourc.query(para);
/*     */     
/* 257 */     BillCardConvertProcessor processor = new BillCardConvertProcessor(ptemplet);
/* 258 */     BillCard retcard = processor.convertByTempletid(this.templetid, this.pagecode, vo);
/* 259 */     if (this.excuteFormula) {
/*     */       
/* 261 */       BillCardFormulaHandler handler = new BillCardFormulaHandler(retcard, ptemplet);
/* 262 */       handler.handleLoadFormula();
/* 263 */       handler.handleBodyLoadFormula();
/*     */     } 
/*     */     
/* 266 */     Translator translator = new Translator(ptemplet);
/* 267 */     translator.setTransFlag(this.transFlag);
/* 268 */     translator.setCodes(this.codes);
/* 269 */     translator.setNoTranslatorCodes(this.noTranslatorCodes);
/* 270 */     translator.translate(retcard);
/* 271 */     this.billcard = retcard;
/* 272 */     return retcard;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCard toCardBySpecialBodyArea(Object vo, String bodyAreaCode) {
/* 284 */     ITempletResource resourc = (ITempletResource)Locator.find(ITempletResource.class);
/* 285 */     TempletQueryPara para = new TempletQueryPara();
/* 286 */     para.setPagecode(this.pagecode);
/* 287 */     para.setTemplateid(this.templetid);
/* 288 */     PageTemplet ptemplet = resourc.query(para);
/*     */     
/* 290 */     BillCardConvertProcessor processor = new BillCardConvertProcessor(ptemplet);
/* 291 */     BillCard retcard = processor.convertByTempletidAndBodyArea(this.templetid, this.pagecode, bodyAreaCode, vo);
/* 292 */     if (this.excuteFormula) {
/*     */       
/* 294 */       BillCardFormulaHandler handler = new BillCardFormulaHandler(retcard, ptemplet);
/* 295 */       handler.handleLoadFormula();
/* 296 */       handler.handleBodyLoadFormula();
/*     */     } 
/*     */     
/* 299 */     Translator translator = new Translator(ptemplet);
/* 300 */     translator.setTransFlag(this.transFlag);
/* 301 */     translator.setCodes(this.codes);
/* 302 */     translator.setNoTranslatorCodes(this.noTranslatorCodes);
/* 303 */     translator.translate(retcard);
/* 304 */     this.billcard = retcard;
/* 305 */     return retcard;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCard toCardExcludeArea(Object vo, boolean isExcludeBodyRelatedArea, String... areacodes) {
/* 317 */     if (!isExcludeBodyRelatedArea && areacodes.length == 0) {
/* 318 */       toCard(vo);
/*     */     }
/*     */ 
/*     */     
/* 322 */     ITempletResource resourc = (ITempletResource)Locator.find(ITempletResource.class);
/* 323 */     TempletQueryPara para = new TempletQueryPara();
/* 324 */     para.setPagecode(this.pagecode);
/* 325 */     para.setTemplateid(this.templetid);
/* 326 */     PageTemplet ptemplet = resourc.query(para);
/*     */     
/* 328 */     HashSet<String> excludeCodes = new HashSet<String>();
/* 329 */     if (isExcludeBodyRelatedArea) {
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */       
/* 336 */       Map<String, AreaRelation> relations = ptemplet.getRelations();
/* 337 */       for (String bodycode : relations.keySet()) {
/* 338 */         for (Area area : ptemplet.getAllAreas()) {
/* 339 */           if (bodycode.equals(area.getRelationcode()) && !bodycode.equals(area.getCode())) {
/* 340 */             excludeCodes.add(area.getCode());
/*     */           }
/*     */         } 
/*     */       } 
/*     */     } 
/* 345 */     if (areacodes.length != 0) {
/* 346 */       excludeCodes.addAll(Arrays.asList(areacodes));
/*     */     }
/*     */ 
/*     */     
/* 350 */     BillCardConvertProcessor processor = new BillCardConvertProcessor(new ArrayList(excludeCodes));
/* 351 */     processor.setPagetemplet(ptemplet);
/* 352 */     BillCard retcard = processor.convert(this.pagecode, vo);
/*     */     
/* 354 */     if (this.excuteFormula) {
/*     */       
/* 356 */       BillCardFormulaHandler handler = new BillCardFormulaHandler(retcard, ptemplet);
/* 357 */       handler.handleLoadFormula();
/* 358 */       handler.handleBodyLoadFormula();
/*     */     } 
/*     */ 
/*     */     
/* 362 */     Translator translator = new Translator(ptemplet);
/* 363 */     translator.setTransFlag(this.transFlag);
/* 364 */     translator.setCodes(this.codes);
/* 365 */     translator.setNoTranslatorCodes(this.noTranslatorCodes);
/* 366 */     translator.translate(retcard);
/* 367 */     this.billcard = retcard;
/* 368 */     return retcard;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCard toCardOnlyDisplayFieldsLefted(final Object vo, String... extraItemCodes) {
/* 384 */     ITempletResource resourc = (ITempletResource)Locator.find(ITempletResource.class);
/* 385 */     TempletQueryPara para = new TempletQueryPara();
/* 386 */     para.setPagecode(this.pagecode);
/* 387 */     para.setTemplateid(this.templetid);
/* 388 */     final PageTemplet ptemplet = resourc.query(para);
/*     */ 
/*     */     
/* 391 */     final HashSet<String> codeSet = packageCodes(extraItemCodes);
/* 392 */     final BaseThreadParam instance = BaseThreadParam.getInstance();
/* 393 */     ExecutorService executor = Executors.newSingleThreadExecutor();
/* 394 */     Future<Map<String, Set<String>>> submit = executor.submit(new AbstractBaseThread<Map<String, Set<String>>>()
/*     */         {
/*     */           public Map<String, Set<String>> run()
/*     */           {
/* 398 */             Set<String> displayFields = getPrimaryFields();
/* 399 */             displayFields.addAll(codeSet);
/*     */             
/* 401 */             Map<String, Area> areas = ptemplet.getAreas();
/* 402 */             Map<String, String[]> formRelation = ptemplet.getFormRelation();
/* 403 */             Map<String, AreaRelation> gridRelations = ptemplet.getRelations();
/*     */ 
/*     */             
/* 406 */             Set<String> formDisplayItem = new HashSet<String>();
/* 407 */             formDisplayItem.addAll(displayFields);
/* 408 */             if (formRelation != null && formRelation.size() > 0) {
/* 409 */               for (Map.Entry<String, String[]> entry : formRelation.entrySet()) {
/* 410 */                 ArrayList<Area> list = new ArrayList<Area>();
/*     */                 
/* 412 */                 String key = (String)entry.getKey();
/* 413 */                 list.add(areas.get(key));
/* 414 */                 for (String string : (String[])entry.getValue()) {
/* 415 */                   list.add(areas.get(string));
/*     */                 }
/*     */                 
/* 418 */                 for (Area area : list) {
/* 419 */                   if (area != null) {
/* 420 */                     List<Item> itemList = area.getItemList();
/* 421 */                     for (Item item : itemList) {
/* 422 */                       if (item.isVisible()) {
/* 423 */                         formDisplayItem.add(item.getCode());
/*     */                       }
/*     */                     } 
/*     */                   } 
/*     */                 } 
/*     */               } 
/*     */             }
/*     */ 
/*     */             
/* 432 */             Set<String> gridDisplayItem = new HashSet<String>();
/* 433 */             gridDisplayItem.addAll(displayFields);
/* 434 */             if (gridRelations != null && gridRelations.size() > 0) {
/* 435 */               for (Map.Entry<String, AreaRelation> entry : gridRelations.entrySet()) {
/* 436 */                 ArrayList<Area> list = new ArrayList<Area>();
/*     */                 
/* 438 */                 AreaRelation value = (AreaRelation)entry.getValue();
/* 439 */                 list.add(areas.get(value.getSrcAreaCode()));
/* 440 */                 list.add(areas.get(value.getDestBrowseAreaCode()));
/* 441 */                 for (String string : value.getDestEditAreaCode()) {
/* 442 */                   list.add(areas.get(string));
/*     */                 }
/*     */                 
/* 445 */                 for (Area area : list) {
/* 446 */                   if (area != null) {
/* 447 */                     List<Item> itemList = area.getItemList();
/* 448 */                     for (Item item : itemList) {
/* 449 */                       if (item.isVisible()) {
/* 450 */                         gridDisplayItem.add(item.getCode());
/*     */                       }
/*     */                     } 
/*     */                   } 
/*     */                 } 
/*     */               } 
/*     */             }
/*     */             
/* 458 */             HashMap<String, Set<String>> map = new HashMap<String, Set<String>>();
/* 459 */             map.put("from", formDisplayItem);
/* 460 */             map.put("grid", gridDisplayItem);
/*     */             
/* 462 */             return map;
/*     */           }
/*     */ 
/*     */ 
/*     */           
/* 467 */           protected BaseThreadParam getBaseThreadParam() { return instance; }
/*     */ 
/*     */ 
/*     */ 
/*     */           
/* 472 */           protected boolean logSwitch() { return false; }
/*     */ 
/*     */ 
/*     */           
/*     */           private Set<String> getPrimaryFields() {
/* 477 */             ArrayList<Object> vos = new ArrayList<Object>();
/* 478 */             if (vo instanceof AggregatedValueObject) {
/* 479 */               AggregatedValueObject bill = (AggregatedValueObject)vo;
/* 480 */               CircularlyAccessibleValueObject parentVO = bill.getParentVO();
/* 481 */               vos.add(parentVO);
/*     */               
/* 483 */               CircularlyAccessibleValueObject[] childrenVO = bill.getChildrenVO();
/* 484 */               if (childrenVO != null && childrenVO.length > 0) {
/* 485 */                 vos.add(childrenVO[0]);
/*     */               }
/* 487 */             } else if (vo instanceof IBill) {
/* 488 */               IBill bill = (IBill)vo;
/* 489 */               IVO parent = bill.getParent();
/* 490 */               vos.add(parent);
/*     */               
/* 492 */               IVOMeta[] metas = bill.getMetaData().getChildren();
/* 493 */               if (metas != null && metas.length > 0) {
/* 494 */                 IVO[] children = bill.getChildren(metas[0]);
/* 495 */                 if (children != null && children.length > 0) {
/* 496 */                   vos.add(children[0]);
/*     */                 }
/*     */               } 
/* 499 */             } else if (vo instanceof SpecilAggBill) {
/* 500 */               SpecilAggBill bill = (SpecilAggBill)vo;
/* 501 */               SuperVO head = bill.getHead();
/* 502 */               vos.add(head);
/*     */               
/* 504 */               SuperVO[] bodys = bill.getBodys();
/* 505 */               if (bodys != null && bodys.length > 0) {
/* 506 */                 vos.add(bodys[0]);
/*     */               }
/*     */             } 
/*     */ 
/*     */             
/* 511 */             HashSet<String> names = new HashSet<String>();
/* 512 */             if (vos.size() > 0) {
/* 513 */               for (Object object : vos) {
/* 514 */                 if (object != null) {
/*     */                   try {
/* 516 */                     if (object instanceof SuperVO) {
/* 517 */                       SuperVO o = (SuperVO)object;
/* 518 */                       String parentPKFieldName = o.getParentPKFieldName();
/* 519 */                       if (parentPKFieldName != null) {
/* 520 */                         names.add(parentPKFieldName);
/*     */                       }
/* 522 */                       String pkFieldName = o.getPKFieldName();
/* 523 */                       if (pkFieldName != null) {
/* 524 */                         names.add(pkFieldName);
/*     */                       }
/*     */                     } 
/*     */                     
/* 528 */                     if (object instanceof IVO) {
/* 529 */                       IVO o = (IVO)object;
/* 530 */                       String name = o.getMeta().getPrimaryAttribute().getName();
/* 531 */                       if (name != null) {
/* 532 */                         names.add(name);
/*     */                       }
/*     */                     } 
/* 535 */                   } catch (Exception ex) {}
/*     */                 }
/*     */               } 
/*     */             }
/*     */ 
/*     */ 
/*     */ 
/*     */             
/* 543 */             registerImportantInterface(names, nc.itf.uap.pf.metadata.IFlowBizItf.class);
/*     */             
/* 545 */             registerImportantInterface(names, nc.itf.pubapp.pub.bill.IOrgInfo.class);
/*     */             
/* 547 */             registerImportantInterface(names, nc.itf.pubapp.pub.bill.IRowNo.class);
/*     */             
/* 549 */             registerImportantInterface(names, nc.vo.bd.meta.IBDObject.class);
/*     */             
/* 551 */             registerImportantInterface(names, nc.itf.pubapp.pub.bill.IAuditInfo.class);
/*     */             
/* 553 */             return names;
/*     */           }
/*     */           
/*     */           private void registerImportantInterface(HashSet<String> names, Class<?> clz) {
/* 557 */             NCObject ncobj = NCObject.newInstance(vo);
/* 558 */             IBusinessEntity entity = (IBusinessEntity)ncobj.getRelatedBean();
/* 559 */             boolean itfHasImpl = entity.isImplementBizInterface(clz.getName());
/* 560 */             if (!itfHasImpl) {
/*     */               return;
/*     */             }
/* 563 */             Map<String, String> dataMap = entity.getBizInterfaceMapInfo(clz.getName());
/*     */             
/* 565 */             if (dataMap != null && dataMap.size() > 0) {
/* 566 */               names.addAll(dataMap.values());
/*     */             }
/*     */           }
/*     */         });
/*     */ 
/*     */     
/* 572 */     BillCardConvertProcessor processor = new BillCardConvertProcessor(ptemplet);
/* 573 */     BillCard retcard = processor.convertByTempletid(this.templetid, this.pagecode, vo);
/*     */     
/* 575 */     BillCardFormulaHandler handler = new BillCardFormulaHandler(retcard, ptemplet);
/* 576 */     handler.handleLoadFormula();
/* 577 */     handler.handleBodyLoadFormula();
/*     */     
/* 579 */     Translator translator = new Translator(ptemplet);
/* 580 */     translator.setTransFlag(this.transFlag);
/* 581 */     translator.setCodes(this.codes);
/* 582 */     translator.setNoTranslatorCodes(this.noTranslatorCodes);
/* 583 */     translator.translate(retcard);
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     
/*     */     try {
/* 592 */       Map<String, Set<String>> map = (Map)submit.get();
/*     */       
/* 594 */       ArrayList<Row> arrayListH = new ArrayList<Row>();
/* 595 */       ArrayList<Row> arrayListB = new ArrayList<Row>();
/*     */       
/*     */       try {
/* 598 */         Row[] rowsH = retcard.getHead().getModel().getRows();
/* 599 */         for (Row row : rowsH) {
/* 600 */           arrayListH.add(row);
/*     */         }
/* 602 */         Row[] rowsB = retcard.getBody().getModel().getRows();
/* 603 */         for (Row row : rowsB) {
/* 604 */           arrayListB.add(row);
/*     */         }
/* 606 */         Row[] rowsT = retcard.getTail().getModel().getRows();
/* 607 */         for (Row row : rowsT) {
/* 608 */           arrayListH.add(row);
/*     */         }
/* 610 */       } catch (NullPointerException ex) {
/* 611 */         ExceptionUtils.wrapException(ex);
/*     */       } 
/*     */       
/* 614 */       Set<String> formSet = (Set)map.get("from");
/* 615 */       for (Row row : arrayListH) {
/* 616 */         if (row != null) {
/* 617 */           Map<String, Cell> values = row.getValues();
/*     */           
/* 619 */           HashSet<String> set = new HashSet<String>();
/* 620 */           for (String key : values.keySet()) {
/* 621 */             if (!formSet.contains(key)) {
/* 622 */               set.add(key);
/*     */             }
/*     */           } 
/*     */ 
/*     */           
/* 627 */           for (String string : set) {
/* 628 */             values.remove(string);
/*     */           }
/*     */         } 
/*     */       } 
/*     */       
/* 633 */       Set<String> gridSet = (Set)map.get("grid");
/* 634 */       HashSet<String> set = new HashSet<String>();
/* 635 */       for (Row row : arrayListB) {
/* 636 */         if (row != null) {
/* 637 */           Map<String, Cell> values = row.getValues();
/*     */           
/* 639 */           if (set.size() == 0) {
/* 640 */             for (String key : values.keySet()) {
/* 641 */               if (!gridSet.contains(key)) {
/* 642 */                 set.add(key);
/*     */               }
/*     */             } 
/*     */           }
/*     */ 
/*     */           
/* 648 */           for (String string : set) {
/* 649 */             values.remove(string);
/*     */           }
/*     */         } 
/*     */       } 
/* 653 */     } catch (Exception ex) {
/* 654 */       PlatformBaseLogUtils.error(ex);
/*     */     } 
/*     */ 
/*     */ 
/*     */     
/* 659 */     return retcard;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCard toCompareCard(Object vo) {
/* 670 */     ITempletResource resourc = (ITempletResource)Locator.find(ITempletResource.class);
/* 671 */     TempletQueryPara para = new TempletQueryPara();
/* 672 */     para.setPagecode(this.pagecode);
/* 673 */     para.setTemplateid(this.templetid);
/* 674 */     PageTemplet ptemplet = resourc.query(para);
/*     */     
/* 676 */     BillCardConvertProcessor processor = new BillCardConvertProcessor(ptemplet);
/* 677 */     BillCard retcard = processor.convertByTempletid(this.templetid, this.pagecode, vo);
/*     */     
/* 679 */     BillCardFormulaHandler handler = new BillCardFormulaHandler(retcard, ptemplet);
/* 680 */     handler.handleLoadFormula();
/* 681 */     handler.handleBodyLoadFormula();
/*     */     
/* 683 */     Translator translator = new Translator(ptemplet);
/* 684 */     translator.setTransFlag(this.transFlag);
/* 685 */     translator.setCodes(this.codes);
/* 686 */     translator.setNoTranslatorCodes(this.noTranslatorCodes);
/* 687 */     translator.translate(retcard);
/*     */     
/* 689 */     Row[] oldRows = this.billcard.getBody().getModel().getRows();
/* 690 */     Row[] newRows = retcard.getBody().getModel().getRows();
/*     */     
/* 692 */     GridCompareUtils.compareRows(oldRows, newRows);
/*     */     
/* 694 */     this.billcard = retcard;
/* 695 */     return retcard;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BillCard toOriginCard(Object vo) {
/* 707 */     ITempletResource resourc = (ITempletResource)Locator.find(ITempletResource.class);
/* 708 */     TempletQueryPara para = new TempletQueryPara();
/* 709 */     para.setPagecode(this.pagecode);
/* 710 */     para.setTemplateid(this.templetid);
/* 711 */     PageTemplet ptemplet = resourc.query(para);
/*     */     
/* 713 */     BillCardConvertProcessor processor = new BillCardConvertProcessor(ptemplet);
/* 714 */     BillCard retcard = processor.convertByTempletid(this.templetid, this.pagecode, vo);
/* 715 */     this.originBillcard = retcard;
/* 716 */     return retcard;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   private HashSet<String> packageCodes(String[] extraItemCodes) {
/* 726 */     HashSet<String> codeSet = new HashSet<String>();
/* 727 */     for (String code : extraItemCodes) {
/* 728 */       codeSet.add(code);
/*     */     }
/* 730 */     codeSet.add("ts");
/* 731 */     return codeSet;
/*     */   }
/*     */ }


/* Location:              E:\zhuhai_ncc\NCC2111\external\lib\pubplatform_baseLevel-1.jar!/nccloud/framework/web/ui/pattern/billcard/BillCardOperator.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */